1. Field of the Invention
The present invention generally relates to binding data in a computer system and, more particularly, to a method and system which exploit the hierarchical nature of both control organization and data storage with support for powerful expression to locate the data item of interest.
2. Background Description
Many computer applications find it preferable to link their controls to data in a manner that limits the need for each control to know what other controls are interested in the same data item. This preference is enhanced when the data is organized in a hierarchical manner (where a tree is the natural manner for viewing the data structure) in order to eliminate the need for a control to also know about other controls interested in the parent(s) of the data item. A further extension is often desired for when the data resides on one (logical) machine, the server, and the controls may exist on multiple machines, the clients.
Various approaches to this issue have been employed over time. In one approach, a client acquires a lock on the data, and all other clients are restricted to a read-only access. Upon write back of any changes on the first client, another client may claim the lock on the updated version of the data. While this approach is most often used at an application level in client/server systems, it can also be applied within an application where the xe2x80x9cclientxe2x80x9d with the lock may be viewed as the control that currently has the focus for user input. The lock may even be implemented in an implicit mode (e.g., belongs to the control with focus) where the data is updated (and other interested controls notified) when the control loses focus.
In another approach, a binding agent keeps track of the logical links between data items and the controls, as disclosed, for example, in U.S. Pat. No. 5,706,505 to Fraley et al. for xe2x80x9cMethod and System for Binding Data in a Computer Systemxe2x80x9d. This agent is then responsible for reflecting changes in the controls to the data and notifying the controls whenever a linked data item is modified.
The present invention is primarily interested in the second of these two approaches, although it also has applicability to other means of logically linking data and controls. A significant limitation in the state of the art, as exemplified by the patent to Fraley et al., is a view of the data that is record oriented, often via a logical interface known as a cursor. While this is appropriate for data stored in many types of databases, it is very limiting for other types of data stores (such as World Wide Web Consortium (W3C) compliant Document Object Model (DOM)). Often it also ignores the hierarchical nature in which most state of the art display systems organize the controls being shown to a user.
It is therefore an object of the present invention to exploit the hierarchical nature of both control organization and data storage.
It is another object of the invention to provide ways to increase the expressive power for locating the data item of interest.
According to the invention, a Web browser (such as Internet Explorer, version 5 (v5), from the Microsoft Corp.) is used as the rendering engine for the client application. The browser is instructed to load a xe2x80x9cpagexe2x80x9d (some set of instructions that eventually resolves to a sequence of HTML (HyperText Markup Language) tags which instruct the browser regarding the number/nature and layout of the controls desired) which the browser parses to produce a set of controls with the indicated containment hierarchy. These controls may contain definitions of data stores (such as the support for an XML (eXtended Markup Language) tag which produces a W3C compliant DOM with built-in parsing for XML documents) which may either locally define their data or cause the browser to request the data from a server on the network. Preferably, the browser then passes control to a data binding agent which will examine the controls for specification of desired data binding(s). This specification may include, but is not limited to, the following:
1. A specification of the context for starting the search for the indicated data item. Examples of such a specification include the identity within the browser of a data store (context taken as the root of the data store), identity of another control whose data binding should be used as the context, or a default, to examine the xe2x80x9cparentsxe2x80x9d within the control hierarchy for the closest parent whose data binding could be used to set this context.
2. A specification of how to find a data item relative to the context specified in item 1, above. This is preferably in a syntax native to the data store (e.g., XSL (eXtensible Script Language) pattern or XPath expression when the data store is an W3C compliant DOM), although one skilled in the art could implement other syntax and supporting code for locating the desired data item. Examples of such a syntax include extending an XSL pattern by supporting a portion of the specification being replaced by data referenced off some control, data item, or computed by some function prior to evaluation by the native system.
3. A specification of what property on the control is to be xe2x80x9cboundxe2x80x9d to the data item where xe2x80x9cboundxe2x80x9d means that the value of the data item and the value of the property of the control are kept synchronized with each other. Support that defaults to this specification to be the rendered property can be quite useful. Also useful is permitting a specification that no property is to be xe2x80x9cboundxe2x80x9d to the data item although the control should still be registered as interested in changes to the data item.
4. A specification of code to execute whenever the bound data item changes. This notification allows the control to perform arbitrary actions on this notification. One skilled in the art can easily extend this to include both pre and post notification of changes as well as other useful means of informing the control that a change is occurring or has occurred.
5. A specification of code to execute whenever something has caused a change in the data item bound to the control. This allows the control to perform arbitrary actions based on this notification. One skilled in the art can easily extend this to include both pre and post notification of data binding changes as well as other useful means of informing the control that its data binding is changing or has changed.
The data binding preferably occurs after both the data and control structure are parsed into their respective DOM structures, but before the page is rendered for the user, although one skilled in the art can easily accomplish these ends in other circumstances.
In addition, this invention includes support for controls which may not be directly parsed and instantiated by the browser (e.g., computational code) and which may or may not have any associated display. These controls may register an interest in various data items and receive notifications when those data items change.
This invention also supports the data binding agent optionally creating a specified data item within the specified hierarchy should one not exist at the time the data binding agent executes.